package edu.parq.uaa.io;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

import edu.parq.uaa.db.DB;

public class FileReader {

	public FileReader(File file) throws Exception {

		DB db = new DB();
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream(file), "UTF8"));

		String str;
		int i = 0;
		while ((str = in.readLine()) != null) {

			String[] strs = str.split(";;;");

			if (strs.length == 12) {
				db.addData(strs);
				
				System.out.print(i + ": ");
				for (int j = 0; j < strs.length; j++) {
					System.out.print("[" + j + "] " + strs[j] + "\t");
				}
			}
			System.out.println();
			++i;

		}

		in.close();
		db.close();
	}

	public static void main(String[] args) throws Exception {
		new FileReader(new File("H:/UrduForum/itdarasgah.txt"));
	}

}
